<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getFileInfoApi } from '@/apis/globalSbmitForm.js'
import fileDetail from '@/components/upload/fileDetail.vue'

const logInfo = ref({})
onLoad((options) => {
  logInfo.value = JSON.parse(options.logData)
})

</script>

<template>
  <view class="log-detail-container page_container">
    <view class="content">
      <view class="detail-card">
        <view class="detail-section">
          <view class="info-item">
            <text class="info-label">订单ID:</text>
            <text class="info-value">{{ logInfo.inorderid || logInfo.outorderid || '未知' }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">操作类型:</text>
            <text class="info-value">{{ logInfo.opertype || '无' }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">操作日期:</text>
            <text class="info-value">{{ logInfo.operdate || '无' }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">操作内容:</text>
            <text class="info-value">{{ logInfo.operinfo || '无' }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">备注:</text>
            <text class="info-value">{{ logInfo.memo || '无' }}</text>
          </view>
          <view class="info-item">
            <template v-if="logInfo.id">
              <fileDetail :id="logInfo.id" />
            </template>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>


<style scoped lang="scss">
/* 详情卡片 */
.detail-card {
  background: #ffffff;
  border-radius: 16rpx;
  padding: 20rpx;
  box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
  border: 1rpx solid #eee;
}

.detail-section {
  margin-bottom: 20rpx;

  &:last-child {
    margin-bottom: 0;
  }
}

/* 信息项 */
.info-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 20rpx;
  padding: 10rpx 0;
  border-bottom: 1rpx solid #f0f0f0;

  &.full-width {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  &:last-child {
    margin-bottom: 0;
    border-bottom: none;
  }
}

.info-label {
  font-size: $list-font-size;
  color: $list-color;
  width: 160rpx;
  flex-shrink: 0;
  text-align: left;
  font-weight: 500;
}

.info-value {
  font-size: $list-font-size;
  color: $list-color;
  line-height: 40rpx;
  flex: 1;
  text-align: left;
  word-break: break-all;
  padding-left: 20rpx;

  .info-item.full-width & {
    padding-left: 0;
    margin-top: 8rpx;
  }

  &.text-area {
    min-height: 80rpx;
    word-break: break-all;
    white-space: pre-wrap;
  }
}
</style>
